/*
 * acm1457.c
 *
 *  Created on: 11 Apr 2010
 *      Author: xuxu
 */

#include<stdio.h>
#include<string.h>
int n;
int num[21];
int mark[21];
int count;
int prime[12]={2,3,5,7,11,13,17,19,23,29,31,37};

void finder(int x)
{
	int i,j;
	if(n==x)
	{
		for(i=0;i<12;i++)
		{
			if(num[n-1]+num[0]==prime[i])
			{
				printf("1");
				for(j=1;j<n;j++)
				{
					printf(" %d",num[j]);
				}
				printf("\n");
				return ;
			}
		}
		return ;
	}
	for(i=2;i<=n;i++)
	{
		if(!mark[i])
		{
			for(j=0;j<12;j++)
			{
				if(i+num[x-1]==prime[j])
				{
					num[x]=i;
					mark[i]=1;
					finder(x+1);
					mark[i]=0;
					break;
				}
				else if(i+num[x-1]<prime[j])
					break;
			}
		}
	}
}

int main()
{
	int con;
	con=1;
	while(scanf("%d",&n)!=EOF)
	{
		if(0!=n%2)
			printf("Case %d:\n",con);
		else
		{
			printf("Case %d:\n",con);
			num[0]=1;
			memset(mark,0,sizeof(mark));
			mark[1]=1;
			finder(1);
		}
		printf("\n");
		con++;
	}
	return 0;
}
